package org.example.demo05;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test05 {
    //5.使用字节流 实现文件内容的拷贝 （源目录：C:/source/01.txt,目的目录：D:/target/01.txt）
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("C:/source/01.txt");
        FileOutputStream fileOutputStream = new FileOutputStream("C:/source/02.txt");
        byte[] bytes = new byte[1024];
        int len = -1;
        while ((len = fileInputStream.read(bytes)) != -1) {
            fileOutputStream.write(bytes, 0, len);
        }
        fileInputStream.close();
        fileOutputStream.close();
    }
}
